import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PowerWorkVO, PowerWorkForm, PowerWorkQuery } from '@/api/system/powerWork/types';

/**
 * 查询临时用电作业列表
 * @param query
 * @returns {*}
 */

export const listPowerWork = (query?: PowerWorkQuery): AxiosPromise<PowerWorkVO[]> => {
  return request({
    url: '/system/powerWork/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询临时用电作业详细
 * @param id
 */
export const getPowerWork = (id: string | number): AxiosPromise<PowerWorkVO> => {
  return request({
    url: '/system/powerWork/' + id,
    method: 'get'
  });
};

/**
 * 新增临时用电作业
 * @param data
 */
export const addPowerWork = (data: PowerWorkForm) => {
  return request({
    url: '/system/powerWork',
    method: 'post',
    data: data
  });
};

/**
 * 修改临时用电作业
 * @param data
 */
export const updatePowerWork = (data: PowerWorkForm) => {
  return request({
    url: '/system/powerWork',
    method: 'put',
    data: data
  });
};

/**
 * 删除临时用电作业
 * @param id
 */
export const delPowerWork = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/powerWork/' + id,
    method: 'delete'
  });
};
